// @ts-ignore
/* eslint-disable */

import { request, type RequestOptions } from '@/utils/request';

/**
* 获取工单操作日志列表
* @param workOrderId 工单ID
* @param pageIndex 页码
* @param pageSize 页大小
* @param operationType 操作类型
* @param operatorId 操作人ID
* @param startTime 开始时间
* @param endTime 结束时间
* @returns
*/
export async function getLogs(
  workOrderId?: string, 
  pageIndex: number = 1, 
  pageSize: number = 20,
  operationType?: number,
  operatorId?: string,
  startTime?: string,
  endTime?: string,
  options?: RequestOptions
) {
  return request<any[]>(`workorder/operation-logs`, {
    method: 'GET',
    params: { 
      workOrderId, 
      pageIndex, 
      pageSize, 
      operationType, 
      operatorId, 
      startTime, 
      endTime 
    },
    ...(options || {}),
  });
}

/**
* 获取操作日志数量
* @param workOrderId 工单ID
* @param operationType 操作类型
* @param operatorId 操作人ID
* @param startTime 开始时间
* @param endTime 结束时间
* @returns
*/
export async function countLogs(
  workOrderId?: string,
  operationType?: number,
  operatorId?: string,
  startTime?: string,
  endTime?: string,
  options?: RequestOptions
) {
  return request<number>(`workorder/operation-logs/count`, {
    method: 'GET',
    params: { workOrderId, operationType, operatorId, startTime, endTime },
    ...(options || {}),
  });
}

/**
* 获取用户最近操作日志
* @param operatorId 操作人ID
* @param count 记录数量
* @returns
*/
export async function getRecentLogs(
  operatorId: string,
  count: number = 10,
  options?: RequestOptions
) {
  return request<any[]>(`workorder/operation-logs/recent`, {
    method: 'GET',
    params: { operatorId, count },
    ...(options || {}),
  });
} 